package com.icangya.DAO.impl;

import com.icangya.DAO.IRwShopSharesRecordDAO;
import com.icangya.Utils.SQLUtilt;
import com.icangya.domain.RwShopSharesRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import java.util.List;

import static com.icangya.Value.FootBall.FOOT_PAGE_ROW;

@Repository
public class RwShopSharesRecordDAOImpl extends  BaseDAO<RwShopSharesRecord> implements IRwShopSharesRecordDAO {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public List getRwShopSharesRecord(String openId, int startPage) {
        String hql=" FROM RwShopSharesRecord cr where cr.openid='"+openId+"' order by cr.createTime desc";
        String count = "SELECT COUNT(cr) " + hql;
        Long total = (Long) getHibernateTemplate().find(count).get(0);
        return SQLUtilt.getIstance().doPage(getHibernateTemplate(), hql, total, startPage, 10);
    }
}
